From: Brion Vibber Date: Sun, 10 Jul 2005 23:46:37 +0000 (+0000) Subject: * (bug 2789) memcached image metadata now cleared after deletion X-Git-Tag: 1.5.0beta4~166 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=526f7811c14c7b7935da7057107400c4a4639a50;p=lhc%2Fweb%2Fwiklou.git * (bug 2789) memcached image metadata now cleared after deletion --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index ba9f7df53c..e03b3eb4d9 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -556,6 +556,8 @@ of MediaWiki:Newpagetext) to &action=edit, if page is new. * Cleaned up email notification message formatting * Finally fixed Special:Disambiguations that was broke since SCHEMA_WORK * (bug 2761) fix capitalization of "i" in Turkish +* (bug 2789) memcached image metadata now cleared after deletion + === Caveats === diff --git a/includes/Image.php b/includes/Image.php index edb2418ed8..01222e2794 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -173,11 +173,11 @@ class Image function saveToCache() { global $wgMemc; $this->load(); - // We can't cache metadata for non-existent files, because if the file later appears - // in commons, the local keys won't be purged. + $keys = $this->getCacheKeys(); if ( $this->fileExists ) { - $keys = $this->getCacheKeys(); - + // We can't cache negative metadata for non-existent files, + // because if the file later appears in commons, the local + // keys won't be purged. $cachedValues = array('name' => $this->name, 'imagePath' => $this->imagePath, 'fileExists' => $this->fileExists, @@ -191,6 +191,10 @@ class Image 'size' => $this->size); $wgMemc->set( $keys[0], $cachedValues ); + } else { + // However we should clear them, so they aren't leftover + // if we've deleted the file. + $wgMemc->delete( $keys[0] ); } }